<link type="text/css" href="/admins/js/pagerView/pager-view.css" rel="stylesheet" />
<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/admins/js/jquery/jquery-ui-1.8.20.custom.min.js"></script>
<script type="text/javascript" src="/admins/js/jquery/jquery.ui.datepicker-zh-CN.js"></script>
<script type="text/javascript" src="/admins/js/pagerView/pager-view.js"></script>
<style>
    #billboy{
        font-size: 14px;
        margin-bottom: 20px;
        margin-left: 20px;
        margin-top: 20px;
        width: 760px;
    }
    #userdetail{
        border-bottom: 1px solid #000000;
        line-height: 36px;
        padding-left: 20px;
        padding-bottom: 10px;
    }
    #packdetail{
        border-bottom: 1px solid #000000;
        line-height: 36px;
        padding-left: 20px;
        padding-bottom: 10px;
    }
    #formto{
        border-bottom: 1px solid #000000;
        line-height: 36px;
        padding-left: 20px;
        padding-bottom: 10px;
    }
    #billboy table td{
        border: 1px solid #CCCCCC;
    }
    #packdetail table td{
        border: 1px solid #CCCCCC;
    }
    #bf{
        background-color: #eee;
        text-align: right;
        width: 120px;
    }
    #cf{
        width: 230px;
    }
    
</style>
<script type="text/javascript">
    $(function(){
    
        $.datepicker.setDefaults( $.datepicker.regional[ "zh-CN" ] );
        $( "#packdetail #birthday" ).datepicker({
            changeMonth: true,
            changeYear: true
        });
    });
</script>
<div id='billboy'>
    <form method="post"  >
    <div id='userdetail'>
        用户信息
        <table width="720" border="1" cellpadding="0" cellspacing="0">
            <tr>
              <td id='bf'>用户名：</td>
              <td id='cf'>&nbsp;&nbsp;<input type="text" name="realname" id="realname" value="<?php echo $this->userdetail?$this->userdetail->realname:"";?>" /></td>
              <td id='bf'>呢称：</td>
              <td id='cf'>&nbsp;&nbsp;<input type="text" name="nikename" id="nikename" value="<?php echo $this->userdetail?$this->userdetail->nikename:"";?>"/></td>
            </tr>
            <tr>
              <td id='bf'>Email：</td>
              <td id='cf'>&nbsp;&nbsp;<input type="text" name="uemail" id="uemail" value="<?php echo $this->userdetail?$this->userdetail->email:"";?>" size="30"/></td>
              <td id='bf'>成长值：</td>
              <td id='cf'>&nbsp;&nbsp;<input type="text" name="score" id="score" value="<?php echo $this->userdetail?($this->userdetail->byscore?$this->userdetail->byscore->score:""):"";?>" /></td>
            </tr>
            <tr>
              <td id='bf'>仓库号：</td>
              <td id='cf'>&nbsp;&nbsp;<?php echo $this->userdetail->storeno;?></td>
              <td id='cf'  colspan="2" style="text-align:right;"><input type="button" name="repwd" id="repwd" value="重置密码" />&nbsp;&nbsp;</td>
            </tr>
          </table>
    </div>
    <div id="packdetail">
        扩展用户信息
        <table width="720" border="1" cellpadding="0" cellspacing="0">
            <tr>
              <td id='bf'>名称：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="name" id="name" value="<?php echo $this->profile?$this->profile->name:"";?>" /></td>
              <td id='bf'>昵称：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="nickName" id="nickName" value="<?php echo $this->profile?$this->profile->nickName:"";?>" /></td>
            </tr>
            <tr>
              <td id='bf'>手机号：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="tel" id="tel" value="<?php echo $this->profile?$this->profile->tel:"";?>" /></td>
              <td id='bf'>Email：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="email" id="email" value="<?php echo $this->profile?$this->profile->email:"";?>" /></td>
            </tr>
           <tr>
              <td id='bf'>生日：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="birthday" id="birthday" value="<?php echo $this->profile?$this->profile->birthday:"";?>" /></td>
              <td id='bf'>性别：</td><td id='cf'>&nbsp;&nbsp;<select id="sex" name="sex">
                      <option value="男" <?php echo $this->profile?($this->profile->sex=="男"?"selected":""):"selected";?> />男</option>
                      <option value="女" <?php echo $this->profile?($this->profile->sex=="女"?"selected":""):""?> />女</option>
                  </select></td>
            </tr>
            <tr>
              <td id='bf'>说明：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="description" id="description" value="<?php echo $this->profile?$this->profile->description:"";?>" /></td>
              <td id='bf'>QQ：</td><td id='cf'>&nbsp;&nbsp;<input type="text" name="qq" id="qq" value="<?php echo $this->profile?$this->profile->qq:"";?>" /></td>
            </tr>
            <tr>
              <td id='bf'>语言：</td><td colspan="3" id='cf'>&nbsp;&nbsp;<input type="text" name="lang" id="lang" value="<?php echo $this->profile?$this->profile->lang:"";?>" size="50"/></td>
            </tr>
            <tr>
              <td id='bf'>家乡：</td><td colspan="3" id='cf'>&nbsp;&nbsp;<input type="text" name="home" id="home" value="<?php echo $this->profile?$this->profile->home:"";?>" size="50"/></td>
            </tr>
            <tr>
              <td id='bf'>地址：</td><td colspan="3" id='cf'>&nbsp;&nbsp;<input type="text" name="address" id="address" value="<?php echo $this->profile?$this->profile->address:"";?>" size="80"/></td>
            </tr>
            <tr>
                <td colspan="4" align="center"><input type="hidden" id="id" name="id" value="<?php echo $this->userdetail->id;?>" />
                    <input type="hidden" id="operate" name="operate" value="edituser" />
                    <input type='submit' name="submit" id="submit" value="确认提交" onclick="return ckform()" />&nbsp;&nbsp;&nbsp;
                    &nbsp;&nbsp;&nbsp;<input type='reset' name="reset" id="reset" value="重新填写" />&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="button" id="refo" naem="refo" value="返回" /></td>
            </tr>
        </table>
    </div>
    </form>
</div>
<?php
if(isset($this->message) && $this->message!=1){
    echo '<script language="javascript" type="text/javascript">alert("'. $this->message .'")</script>';
}else if($this->message==1){
     echo '<script language="javascript" type="text/javascript">alert("修改成功");location.href = "/admini/manageuser/index/";</script>';
}
?>
<script language='javascript'>
    function ckform()
    {
        var realname = $('#nikename').val();
        var uemail = $('#uemail').val();
        if(realname == ''){
            alert('昵称不能为空！');
            return false;
        }else if(uemail == ''){
            alert('用户邮箱不能为空！');
            return false;
        }else{
            return true;
        }
    }
    $("#refo").click(function(){
       javascript:history.go(-1);
    });
    $('#repwd').click(function(){
        var id = $('#id').val();
        $.ajax({
            type: 'POST',
            url: '/admini/manageuser/repwd/id/'+id,
            success: function(data) {
		if (data == true) {
                    alert( "重置成功！" );
		} else {
                    alert( "重置失败！" );
		}
            }
          });
    });
</script>